package gemini.castor.ui.client.page.menu;

import gemini.castor.ui.client.utils.PlaceConstants.MenuItem;

import com.google.gwt.event.shared.GwtEvent;

public class MenuEvent extends GwtEvent<MenuHandler> {
	
	private static Type<MenuHandler> TYPE;
	private MenuItem menuItem;

	public static Type<MenuHandler> getType() {
		if (TYPE == null)
			TYPE = new Type<MenuHandler>();
		return TYPE;
	}
	
	public MenuEvent(MenuItem _menuItem){
		setMenuItem(_menuItem);
	}
	
	@Override
	protected void dispatch(MenuHandler handler) {
		handler.onSelected(this);
	}

	@Override
	public Type<MenuHandler> getAssociatedType() {
		return getType();
	}

	public void setMenuItem(MenuItem menuItem) {
		this.menuItem = menuItem;
	}

	public MenuItem getMenuItem() {
		return menuItem;
	}
}
